update to recent rust changes: part #2
authorСухарик <suhr@i2pmail.org>
Sat, 24 Jan 2015 08:16:54 +0000 (11:16 +0300)
committerСухарик <suhr@i2pmail.org>
Sat, 24 Jan 2015 08:16:54 +0000 (11:16 +0300)
Cargo.lock
src/cargo/core/package_id.rs
src/cargo/util/errors.rs

index b02ee8715538b9d434975a881e0dfe7408096bf4..c6832f1d26cc84da448630542425e4dc2eda6803 100644 (file)
@@ -4,9 +4,9 @@ version = "0.1.0"
 dependencies = [
  "advapi32-sys 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "curl 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "docopt 0.6.30 (registry+https://github.com/rust-lang/crates.io-index)",
+ "docopt 0.6.31 (registry+https://github.com/rust-lang/crates.io-index)",
  "flate2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "glob 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
  "log 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -15,9 +15,9 @@ dependencies = [
  "semver 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
  "tar 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "term 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "time 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -41,7 +41,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "curl-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "openssl-sys 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -57,7 +57,7 @@ dependencies = [
 
 [[package]]
 name = "docopt"
-version = "0.6.30"
+version = "0.6.31"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "regex 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -79,12 +79,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "git2"
-version = "0.1.11"
+version = "0.1.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "libgit2-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -112,7 +112,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "libgit2-sys"
-version = "0.1.8"
+version = "0.1.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libssh2-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -227,10 +227,11 @@ dependencies = [
 
 [[package]]
 name = "time"
-version = "0.1.12"
+version = "0.1.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "gcc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -243,7 +244,7 @@ dependencies = [
 
 [[package]]
 name = "url"
-version = "0.2.16"
+version = "0.2.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
index 5f78233eb7443ceb9779ea31f921ea771b5a884b..9d999890f2252d6d70969fc6cf548581b26a02ce 100644 (file)
@@ -89,15 +89,18 @@ pub enum PackageIdError {
 
 impl Error for PackageIdError {
     fn description(&self) -> &str { "failed to parse package id" }
-    fn detail(&self) -> Option<String> {
-        Some(match *self {
+}
+
+impl fmt::Display for PackageIdError {
+    fn fmt(self, f: fmt::Formatter) {
+        match self {
             PackageIdError::InvalidVersion(ref v) => {
-                format!("invalid version: {}", *v)
+                write!(f, "invalid version: {}", *v)
             }
             PackageIdError::InvalidNamespace(ref ns) => {
-                format!("invalid namespace: {}", *ns)
+                write!(f, "invalid namespace: {}", *ns)
             }
-        })
+        }
     }
 }
 
index 041da8f074ce5c299ce82c37c72617a3086428af..32f65372ad187325e013f872f1546462f139c29a 100644 (file)
@@ -36,7 +36,6 @@ impl fmt::Debug for Box<CargoError> {
 
 impl Error for Box<CargoError> {
     fn description(&self) -> &str { (**self).description() }
-    fn detail(&self) -> Option<String> { (**self).detail() }
     fn cause(&self) -> Option<&Error> { (**self).cause() }
 }
 
@@ -89,7 +88,12 @@ impl<T> ChainError<T> for Option<T> {
 
 impl<E: Error> Error for ChainedError<E> {
     fn description(&self) -> &str { self.error.description() }
-    fn detail(&self) -> Option<String> { self.error.detail() }
+}
+
+impl<E: fmt::Display> fmt::Display for ChainedError<E> {
+    fn fmt(&self, f: fmt::Formatter) {
+        fmt::Display::fmt(self.error, f)
+    }
 }
 
 impl<E: CargoError> CargoError for ChainedError<E> {
@@ -109,7 +113,6 @@ pub struct ProcessError {
 
 impl Error for ProcessError {
     fn description(&self) -> &str { self.desc.as_slice() }
-    fn detail(&self) -> Option<String> { None }
     fn cause(&self) -> Option<&Error> {
         self.cause.as_ref().map(|s| s as &Error)
     }
@@ -149,7 +152,6 @@ impl fmt::Debug for ConcreteCargoError {
 
 impl Error for ConcreteCargoError {
     fn description(&self) -> &str { self.description.as_slice() }
-    fn detail(&self) -> Option<String> { self.detail.clone() }
     fn cause(&self) -> Option<&Error> {
         self.cause.as_ref().map(|c| &**c)
     }
@@ -168,10 +170,15 @@ pub struct Human<E>(pub E);
 
 impl<E: Error> Error for Human<E> {
     fn description(&self) -> &str { self.0.description() }
-    fn detail(&self) -> Option<String> { self.0.detail() }
     fn cause(&self) -> Option<&Error> { self.0.cause() }
 }
 
+impl<E: fmt::Display> fmt::Display for Human<E> {
+    fn fmt(self, f: fmt::Formatter) {
+        fmt::Display::fmt(self.0, f)
+    }
+}
+
 impl<E: CargoError> CargoError for Human<E> {
     fn is_human(&self) -> bool { true }
     fn cargo_cause(&self) -> Option<&CargoError> { self.0.cargo_cause() }
@@ -191,10 +198,15 @@ pub struct CliError {
 
 impl Error for CliError {
     fn description(&self) -> &str { self.error.description() }
-    fn detail(&self) -> Option<String> { self.error.detail() }
     fn cause(&self) -> Option<&Error> { self.error.cause() }
 }
 
+impl fmt::Display for CliError {
+    fn fmt(self, f: fmt::Formatter) {
+        fmt::Display::fmt(self.error, f)
+    }
+}
+
 impl CliError {
     pub fn new<S: Str>(error: S, code: u32) -> CliError {
         let error = human(error.as_slice().to_string());